package com.zmhc.product.service.impl;

import java.util.List;
import com.zmhc.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zmhc.product.mapper.WholesaleMapper;
import com.zmhc.product.domain.Wholesale;
import com.zmhc.product.service.IWholesaleService;

/**
 * 批发商品Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-11
 */
@Service
public class WholesaleServiceImpl implements IWholesaleService 
{
    @Autowired
    private WholesaleMapper wholesaleMapper;

    /**
     * 查询批发商品
     * 
     * @param id 批发商品主键
     * @return 批发商品
     */
    @Override
    public Wholesale selectWholesaleById(Long id)
    {
        return wholesaleMapper.selectWholesaleById(id);
    }

    /**
     * 查询批发商品列表
     * 
     * @param wholesale 批发商品
     * @return 批发商品
     */
    @Override
    public List<Wholesale> selectWholesaleList(Wholesale wholesale)
    {
        return wholesaleMapper.selectWholesaleList(wholesale);
    }

    /**
     * 新增批发商品
     * 
     * @param wholesale 批发商品
     * @return 结果
     */
    @Override
    public int insertWholesale(Wholesale wholesale)
    {
        wholesale.setCreateTime(DateUtils.getNowDate());
        return wholesaleMapper.insertWholesale(wholesale);
    }

    /**
     * 修改批发商品
     * 
     * @param wholesale 批发商品
     * @return 结果
     */
    @Override
    public int updateWholesale(Wholesale wholesale)
    {
        wholesale.setUpdateTime(DateUtils.getNowDate());
        return wholesaleMapper.updateWholesale(wholesale);
    }

    /**
     * 批量删除批发商品
     * 
     * @param ids 需要删除的批发商品主键
     * @return 结果
     */
    @Override
    public int deleteWholesaleByIds(Long[] ids)
    {
        return wholesaleMapper.deleteWholesaleByIds(ids);
    }

    /**
     * 删除批发商品信息
     * 
     * @param id 批发商品主键
     * @return 结果
     */
    @Override
    public int deleteWholesaleById(Long id)
    {
        return wholesaleMapper.deleteWholesaleById(id);
    }
}
